<!-- 页面设计已注册版权，部分或全部盗用，一经发现将由【正途知识产权代理（上海）有限公司】律师团队依法维权，特此公告； -->
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{$config['title']}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <link rel="stylesheet" type="text/css" href="{$_G['URL']['HEXIAO_CSS']}css/reset.css">
    <link rel="stylesheet" type="text/css" href="{$_G['URL']['HEXIAO_CSS']}css/swiper.min.css">
    <link rel="stylesheet" type="text/css" href="{$_G['URL']['HEXIAO_CSS']}css/style.css?v=1">
    <script src="{$_G['URL']['YX2020_CSS']}js/md5.js?v=2"></script>
    <script type="text/javascript" src="{$_G['URL']['PUBLIC_JS']}yx2020/ping.js?v=15"></script>
    <script src="{$_G['URL']['HEXIAO_CSS']}js/jquery.js"></script>
    <script src="{$_G['URL']['LOTTERY_CSS']}lottery/js/layer/layer.js"></script>
    <style type="text/css">
        .topBox img { border-radius: 30px;}
    </style>
</head>
<body>

<div class="topBox" style="min-height: 1.47rem">
    <div class="orderTit">
        <img src="{$_G['URL']['HEXIAO_CSS']}images/order.png">
        核销订单信息
    </div>
    <ul>
        <li style="height: 40px;font-size: 20px;width: 100vw;color: #ffffff;">{$shop_item['name']}</li>
    </ul>
</div>
<div class="userBox">
    <div class="userTop">
        <div class="userImg"><img src="{$record_item['avatar']}"></div>
        <div class="userInfor">
            <h2>{$record_item['nickname']}</h2>
            <p><span><img src="{$_G['URL']['HEXIAO_CSS']}images/icon5.png">{$record_item['username']}</span><span><img src="{$_G['URL']['HEXIAO_CSS']}images/icon6.png">{$record_item['mobile']}</span></p>
        </div>
    </div>
</div>

{loop $result['list'] $row}
    {if $row['addtime'] && $row['workerid']}
        <div class="cost">
            <div class="costLeft">
                <h2>{$row['name']}</h2>
                <p>{$row['workername']} {$row['workermobile']}</p>
            </div>
            <div class="costRight">
                <span>已核销</span>
                <div class="clear"></div>
                <p style="text-align: right;">{$row['addtime']}</p>
            </div>
        </div>
    {else}
        <div class="ticketBox" style="display: flex;align-items: center;">
            <input type="checkbox" class="more_checkbox" name="more_check" value="{$row['id']}">
            <h2>{$row['name']}</h2>
            <a href="javascript:void(0);" class="getBtn gift_btn" data-recordid="{$order_id}" data-pid="{$row['id']}">去核销</a>
        </div>
    {/if}
{/loop}

{if !$result['all_hx']}
<div class="fixButton">
    <a href="javascript:void(0);" class="backActive" onclick="verifyAll()">全部核销</a>
    <a href="javascript:void(0);" class="checkNot" onclick="verifyMore()">勾选项核销</a>
</div>
{else}
<div class="fixButton">
    <a href="/{php echo  createMobileUrl('index',array('themeid'=>$themeid));}" class="backActive" >活动链接</a>
</div>
{/if}
<div class="h200"></div>
<div id="screen"></div>

</body>
<script>
<!--    全选核销-->
    function verifyAll() {
        let postUrl = "/{php echo  createMobileUrl('MyorderWorkerCheck',array('themeid'=>$themeid,'order_id'=>$order_id,'from_type'=>2,'verify_type'=>'all'));}";
        $.ajax({
            type:'POST',
            data:{},
            dataType : "json",
            url:postUrl,
            success:function(res){
                if (res.error){
                    layer.msg(res.msg.msg)
                }else{
                    layer.msg(res.msg.msg);
                }
                location.reload();
            }
        });
    }
    //多选核销
    function verifyMore() {
        let pids = '';
        let checkbox = $(".more_checkbox:checked");
        if (checkbox.length<1){
            layer.msg('未勾选核销项，请检查');
            return
        }else{

            for (let i = 0; i<checkbox.length;i++){
                pids+=$(".more_checkbox:checked").eq(i).val()+',';
            }
        }
        //逗号分隔凭借字符串 1，2，3
        if (pids==''){
            layer.msg('未勾选核销项，请检查');
            return
        }
        let postUrl = "/{php echo  createMobileUrl('MyorderWorkerCheck',array('themeid'=>$themeid,'order_id'=>$order_id,'from_type'=>2,'verify_type'=>'more'));}";
        $.ajax({
            type:'POST',
            data:{pids:pids},
            dataType : "json",
            url:postUrl,
            success:function(res){
                if (res.error){
                    layer.msg(res.msg.msg)
                }else{
                    layer.msg(res.msg.msg);
                }
                location.reload();
            }
        });
    }
    //单选核销
    $(".gift_btn").click(function () {
        let pid = $(this).data("pid");
        let postUrl = "/{php echo  createMobileUrl('MyorderWorkerCheck',array('themeid'=>$themeid,'order_id'=>$order_id,'from_type'=>2,'verify_type'=>'only'));}";
        $.ajax({
            type:'POST',
            data:{pid:pid},
            dataType : "json",
            url:postUrl,
            success:function(res){
                if (res.error){
                    layer.msg(res.msg.msg)
                }else{
                    layer.msg(res.msg.msg);
                }
                location.reload();
            }
        });
    });
    function show_qr(msg,qr_img){
        var qrurl = '{$_G['URL']['QRURLNEW']}';
        qrurl = qrurl + urlencode(qr_img);
        console.log(qrurl);
        $('.altTit').html(msg);
        $("#qr_img").attr("src",qrurl);
    }

</script>
</html>
